$def with(id, caption, grid, type)

<div id="$id" class="grid">
	<div>
		<table>
			<caption>
				$caption
			</caption>
			<tbody>
				<tr>
					<td>
					</td>
				$for j in range(GridN):
					$# column are labled from 1 to 9
					<td class="coordinate">
						$(j + 1)
					</td>
				</tr>
				
			$for i in range(GridN):
				<tr>
					$# rows are labled from A to I
					<td class="coordinate">
						$(chr(ord('A') + i))
					</td>
					
					$ classtop = " topborder" if i % 3 == 0 else ""
					$ classbottom = " bottomborder" if i % 3 == 2 else ""
				$for j in range(GridN):
					$ classleft = " leftborder" if j % 3 == 0 else ""
					$ classright = " rightborder" if j % 3 == 2 else ""
					$ classsquare = " even" if squ(i, j) % 2 == 0 else " odd"
					$ value = grid[i][j] if grid and grid[i][j] else ''
					<td id="$type$i$j" class="cell$classtop$classright$classbottom$classleft$classsquare">
						<input name="$type$i$j" type="text" value="$value">
					</td>
				</tr>
			</tbody>
		</table>
	</div>
	<div>
		<input type="button" class="gridEmpty" value="Empty" />
	</div>
</div>

